#pragma once
#include <iostream>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <string>
const char *gpipename = "./fifo";
const mode_t mode = 0666;
const int gsize = 1024;
const int gOnlyWrite = O_WRONLY;
const int gOnlyRead = O_RDONLY;
int OpenPipe(int flag)
{
    int fd = ::open(gpipename, flag);
    if(fd<0)
    {
        std::cerr<<"Open Error"<<std::endl;
    }
    return fd;
}
void _close(int fd)
{
    if (fd >= 0)
        ::close(fd);
}